<?php

declare(strict_types=1);

namespace app\controller;

use app\BaseController;
use \captcha\facade\Captcha;

class Api extends BaseController
{
    protected $version = 'v1';

    /**
     * Api接口方法列表
     */
    public function index()
    {
    }

    /**
     * 创建验证码且返回Token
     */
    public function getCaptcha()
    {
        $captcha = Captcha::create();
        return $this->result('success', [
            'captcha_token' => $captcha['key'],
            'captcha_md5' => $captcha['md5'],
            'captcha_image' => $captcha['base64']
        ]);
    }
}
